<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>restful</title>
    <script src="/js/jquery/jquery.min.js"></script>

    <script>
        $(function () {
            //保存
            $('#save').click(function () {
                $.ajax({
                    url: "/employees",
                    type: "POST",
                    success: function (data) {
                        console.log(data);
                    }
                })
            })

            //更新
            $('#updata').click(function () {
                $.ajax({
                    url: "/employees",   //url
                    data: {id: 56},      //参数
                    type: "PUT",        //请求方式
                    success: function (data) {   //回调行数
                        console.log(data);
                    }
                })
            })

            //删除
            $('#delete').click(function () {
                $.ajax({
                    url: "/employees/45",   //url
                    data: {id: 56},      //参数
                    type: "DELETE",        //请求方式
                    success: function (data) {   //回调行数
                        console.log(data);
                    }
                })
            })
            //查找
            $('#select').click(function () {
                console.log("select");
                $.get("/employees/6/许嵩/34", function (data) {
                    console.log(data);
                })
            })

        })
    </script>

</head>
<body>
<button id="save">保存</button>
<button id="updata">更新</button>
<button id="delete">删除</button>
<button id="select">查找</button>
</body>
</html>